<template>
  <div class="classification_list_right">
    <!-- <p>分离列表 id:{{ $route.params.id }}</p> -->
    <div>
      <p class="right_img">
        <img :src="ylimg" alt="" />
      </p>

      <ul v-for="(item, index) in ullist" :key="index">
        <h2 class="ullist_h2">{{ item.name }}</h2>
        <div class="ullist_div">
          <router-link
            class="ullist_li"
            v-for="(i, index) in item.categoryList"
            :key="index"
            :to="`/category/${$route.params.id}/${i.id}`"
          >
            <p class="ullist_p">
              <img :src="i.wapBannerUrl" alt="" />
              <span>{{ i.name }}</span>
            </p>
          </router-link>
        </div>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      ullist: [],
      ylimg: "",
    };
  },
  watch: {
    $route() {
      this.ss();
    },
  },
  methods: {
    ss() {
      console.log(1111111);
      axios
        .get(
          `/item/cateList.json?csrf_token=1e355578b4254da426007bb196e2cb92&__timestamp=1682671819782&categoryId=${this.$route.params.id}`
        )

        .then((response) => {
          // 分类列表数据
          this.ylimg = response.data.data.currentCategory.bannerList[0].picUrl;
          this.ullist = response.data.data.categoryGroupList;
          // console.log(
          //   "3333333",
          //   response.data.data.currentCategory.bannerList[0].picUrl
          // );
        });
    },
  },
  mounted() {
    this.ss();
  },
};
</script>

<style scoped>
.classification_list_right {
  padding-top: 15px;
  padding-bottom: 49px;
  padding-left: 12px;
  height: 100%;
  overflow: auto;
  box-sizing: border-box;
}
.right_img {
  padding-bottom: 15px;
  margin: 0 auto;
}
.right_img img {
  width: 264px;
  height: 96px;
  /* border: 1px solid #000; */
}
.ullist_h2 {
  text-align: left;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  padding-bottom: 4px;
  border-bottom: 1px solid #d9d9d9;
}
/* ul {
  display: flex;
  flex-direction: column;
} */
.ullist_div {
  display: flex;
  flex-wrap: wrap;
  /* justify-content: space-between; */
}
.ullist_li {
  width: 33.33%;
}
.ullist_p {
  width: 72px;
  display: flex;
  height: 108px;
  flex-direction: column;
  align-items: center;
}
.ullist_p span {
  font-size: 12px;
  color: #333;
}
.ullist_p img {
  width: 72px;
  height: 72px;
}
</style>
